03. Control Architecture

Control Architecture

The Crazyflie exposes two levels of control: velocity commands and attitude commands. As there are two possible options, the development of an offboard controller will be done in two major steps for ease of testing and demonstration:

  • Outer loop controller

    • altitude controller
    • lateral position controller
  • Inner loop controller

    • attitude
    • thrust

The first controller that will be built is the outer loop controller which will compute velocity commands that can be sent to the crazyflie and consists of an altitude controller and a lateral position controller. See the figure below for a schematic of this controller.

The second controller that will be built is the inner loop controller which computes attitude/thrust commands from the velocity commands computed by the outer loop controller. This then feeds those attitude/thrust commands to the Crazyflie. See the figure below for a schematic of this controller.

For the most part these controllers are very similar to the ones from the controls project, with a few exceptions. The altitude controller and lateral position controller will just stop at velocity commands; we won't be calculating all the way to accelerations. The yaw controller will be exactly the same as what was seen in the controls project as we are, once again, controlling yaw rate with the Crazyflie. The velocity controller is new and this is where we will control velocity by commanding attitudes.

As we build the controller step by step, we will actually be leveraging the fact that the Crazyflie already has a controller written for it. This will allow us to only introduce one part of the controller at the time and let the existing controller handling the other elements for us. For example, as we build the altitude controller, we will be leaving lateral velocity control to the Crazyflie so it will maintain 0 velocity in the lateral directions enabling us to focus entirely on the altitude controller.